package com.zzyl.nursing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.domain.Reservation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;

@Mapper
public interface ReservationMapper extends BaseMapper<Reservation> {

    /** 查询当前用户当天取消预约的次数（参数改为Date） */
    Integer selectCancelledCountToday(
            @Param("createBy") Long createBy,
            @Param("todayStart") Date todayStart,
            @Param("todayEnd") Date todayEnd);

    /** 查询指定日期各时间段的已预约数量（参数改为Date） */
    List<Reservation> selectCountByTimeRange(@Param("start") Date start, @Param("end") Date end);

    /** 分页查询用户的预约记录 */
    com.baomidou.mybatisplus.core.metadata.IPage<Reservation> selectUserReservationPage(
            com.baomidou.mybatisplus.extension.plugins.pagination.Page<Reservation> page,
            @Param("createBy") Long createBy,
            @Param("reservation") Reservation reservation);

    /** 查询过期未处理的预约（参数改为Date） */
    List<Reservation> selectExpiredReservations(@Param("now") Date now);
}